import request from '@/utils/request'
import { downFile } from '@/utils/request'

/**
 * bom信息分页查询
 * @param {查询条件} data
 */
export function pageProdBom(query) {
  return request({
    url: 'ProdManage/ProdBom/pageList',
    method: 'get',
    params: query,
  })
}

/**
 * 新增bom信息
 * @param data
 */
export function addProdBom(data) {
  return request({
    url: 'ProdManage/ProdBom',
    method: 'post',
    data: data,
  })
}
/**
 * 修改bom信息
 * @param data
 */
export function updateProdBom(data) {
  return request({
    url: 'ProdManage/ProdBom',
    method: 'PUT',
    data: data,
  })
}
/**
 * 获取bom信息详情
 * @param {Id}
 */
export function getProdBom(id) {
  return request({
    url: 'ProdManage/ProdBom/' + id,
    method: 'get'
  })
}

/**
 * 删除bom信息
 * @param {主键} pid
 */
export function delProdBom(pid) {
  return request({
    url: 'ProdManage/ProdBom/delete',
    method: 'POST',
    data: pid
  })
}
// 导出bom信息
export async function exportProdBom(query) {
  await downFile('ProdManage/ProdBom/export', { ...query })
}
